<?php
	require_once('../inc/fen_fns.php');
	
	sec_session_start();
	$pid = $_GET['pid'];
	
	if (login_check($mysqli, '=', '60') == true) {

						$query = $_DB->Query("SELECT
											fen_publication_app.id as id,
											date_FORMAT(fen_publication_app.date_added , '%d/%m/%Y') as date_added,
											fen_members.titr as titr,
											fen_members.name as name,
											fen_members.surname as surname,
											fen_members.username as username,
											fen_department.department_name as department_name,
											fen_faculty.faculty_name as faculty_name,
											fen_publications.yayin_tipi,
											fen_publications.yayin_turu,
											fen_publications.eser_adi,
											fen_publications.dergi_adi,
											fen_publications.volume,
											fen_publications.issue,
											fen_publications.sayfa,
											fen_publications.yayinevi_adi,
											fen_publications.doi_no,
											fen_publications.yayin_yili,
											fen_publications.yazar_sayisi,
											fen_publications.indeks_turu,
											fen_publications.sinif,
											fen_publications.kitap_adi,
											fen_publications.editor_adi,
											fen_publications.isbn_no,
											fen_publication_app.status
											from fen_publication_app, fen_members, fen_department, fen_faculty, fen_publications
											WHERE
											fen_publication_app.id = '".$pid."' and
											fen_publication_app.member_id = fen_members.id and
											fen_members.department_id = fen_department.id and
											fen_members.faculty_id = fen_faculty.id and
											fen_publication_app.publication_id = fen_publications.id
											");					
						
						if ($_DB->GetResultValue($query, "0", "status") == '0') {
							$status = "<font color=\"#dd0303\">Reddedildi</font>";
						} else if ($_DB->GetResultValue($query, "0", "status") == '1') {
							$status = "<font color=\"#f97b00\">Yeni</font>";
						} else if ($_DB->GetResultValue($query, "0", "status") == '2') {
							$status = "<font color=\"#539e3b\">Rektörlüğe Gönderildi</font>";
						}
						
						$sinif = $_DB->GetResultValue($query, "0", "sinif");
						if ($sinif) { $sinif = "(".$sinif.")"; }
						
						$issue = $_DB->GetResultValue($query, "0", "issue");
						if ($issue) { $issue = "(".$issue.")"; }
						
						$yayin_tipi = $_DB->GetResultValue($query, "0", "yayin_tipi");
		
						
?>

<script type="text/javascript">

$("#rednedenidiger").hide();

function showOther(obj) {  

	if (obj.value == 'Diger') {
		$("#rednedenidiger").show();
	} else {
		$("#rednedenidiger").hide();
	}

} 

function cancelReason(obj) {  

	jQuery(document).ready(function($) {
		  $('a[rel*=facebox]').facebox() 

		  jQuery.facebox({ ajax: 'applications/application-detailed.php?pid='+obj })
	}) 
} 

$(document).ready(function(){
	tooltip();
	
});

</script>


	<div id="user_detailed_div">
<div id="user_detailed_head_div">
<p id="user_detailed_name">&nbsp;
<?php 
			
				echo $_DB->GetResultValue($query, "0", "titr")." ".$_DB->GetResultValue($query, "0", "name")." ".$_DB->GetResultValue($query, "0", "surname");
		
?>
</p>
</div>


<div class="summaryTableSmall2detailed2">


	<form name="input" action="applications/confirmation.php" method="post">
	<table id="appDetailedTable">		
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Fakülte / Bölüm</td>
			<td id="appDetailedTD2a"><?php echo $_DB->GetResultValue($query, "0", "faculty_name")." / ".$_DB->GetResultValue($query, "0", "department_name"); ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Yayın Tipi</td>
			<td id="appDetailedTD2a"><?php echo $yayin_tipi; ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Yayın Türü</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "yayin_turu"); ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Yayın Yılı</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "yayin_yili"); ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Eser Adı</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "eser_adi"); ?></td>
		</tr>
		<tr>
			<td id="appDetailedTD"><br>Reddetme Nedeni</td>
			<td id="appDetailedTD2a">
				<select class="selectLong2" type="text" id="destek_turu" name="cancel_reason" onChange="return showOther(this);">
				<option value="">Seçiniz</option>
				<option value="Web of Science ta Yok">Web of Science ta Yok</option>
				<option value="Kriterlere uygun değil">Kriterlere Uygun Değil</option>	
				<option value="Diger">Diğer</option>			
			</select>
			<span id="rednedenidiger"> <input type="text" id="rednedeni" name="rednedeni" value="" placeholder="Nedeni yazınız"> </span>
			</td>
		</tr>

	</table>


 
		<input type="hidden" name="publication_id" value="<?php echo $_DB->GetResultValue($query, "0", "id"); ?>">
		<input type="submit" id="buttonRed" value="&nbsp;Red">
	</form>

			
				
</div>

<?php 

		} else {
			header('Location: ./index.php?error=2');
		}
		
?>